package com.infolab.aims.domain;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Transient;

import net.sf.jasperreports.engine.export.ooxml.ReportStyleHelper;

import org.apache.commons.lang.StringUtils;

import com.infolab.aims.GlobalConstant;
import com.infolab.aims.common.bean.AbstractModelBean;


@Entity
@Table(name="AMTB_REPORT")
public class Report extends AbstractModelBean implements Serializable {

	@Id
	private String reportId;
	
	private String reportStatus;
	
	private String reportFileName;
	
	private String reportRemarks;
	
	private String reportType;
	
	private String module;
	
	private String subModule;
	
	@Transient
	private String transTypeDesc;
	
	public String getTransTypeDesc() {
		return transTypeDesc;
	}

	public void setTransTypeDesc(String transTypeDesc) {
		this.transTypeDesc = transTypeDesc;
	}

	@Column(length=500)
	private String paramSearch;
	
	@Transient
	private Map<String,String> search = new HashMap<String, String>();

	public String getReportId() {
		return reportId;
	}

	public void setReportId(String reportId) {
		this.reportId = reportId;
	}

	public String getReportStatus() {
		return reportStatus;
	}

	public void setReportStatus(String reportStatus) {
		this.reportStatus = reportStatus;
	}

	public String getReportFileName() {
		return reportFileName;
	}

	public void setReportFileName(String reportFileName) {
		this.reportFileName = reportFileName;
	}

	public String getReportRemarks() {
		return reportRemarks;
	}

	public void setReportRemarks(String reportRemarks) {
		this.reportRemarks = reportRemarks;
	}

	public String getModule() {
		return module;
	}

	public void setModule(String module) {
		this.module = module;
	}

	public String getSubModule() {
		return subModule;
	}

	public void setSubModule(String subModule) {
		this.subModule = subModule;
	}
	
	public Map<String, String> getSearch() {
		return search;
	}

	public void setSearch(Map<String, String> search) {
		this.search = search;
	}

	public String getReportType() {
		return reportType;
	}

	public void setReportType(String reportType) {
		this.reportType = reportType;
	}

	public static boolean isValidModule(String module,String subModule)
	{
		return StringUtils.equalsIgnoreCase(module, GlobalConstant.REPORTMODULE.get(subModule));
	}
	
	

	public String getParamSearch() {
		return paramSearch;
	}

	public void setParamSearch(String paramSearch) {
		this.paramSearch = paramSearch;
	}
	
	public boolean isPdfReport()
	{
		return REPORTTYPE_PDF.equalsIgnoreCase(reportType);
	}
	
	public boolean isExcelReport()
	{
		return REPORTTYPE_EXCEL.equalsIgnoreCase(reportType);
	}

	public static final String REPORTSTATUS_INPROCESS="INPROCESS";
	public static final String REPORTSTATUS_SUCCESS="SUCCESS";
	public static final String REPORTSTATUS_FAIL="FAIL";
	public static final String REPORTSTATUS_NORECORD="NORECORD";
	
	public static final String REPORTTYPE_EXCEL="XLS";
	public static final String REPORTTYPE_PDF="PDF";
}
